﻿#region
/*******************************************************************************
** File Name:		    RightsTypeRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Phoenix.Entity;
using Phoenix.Respository;
using IBatisNet.DataMapper;
using Phoenix.Data.IBatis;

namespace Phoenix.IBatisRepository
{
    public class RightsTypeRepository : BaseIBatisDao,IRightsType
    {
    
		#region  Auto Generation

        public RightsTypeRepository()
            : base("/Config/IBatis/86TCMap.Config")
        {

        }

        public void AddRightsType(ERightsType entity)
        {
			string stmtId = "RightsTypeMap.InsertRightsType";
			 base.SqlMapper.Insert(stmtId, entity);

        }
        
		public  ERightsType GetByTypeID (System.Int32 typeID)
        {
			string stmtId = "RightsTypeMap.SelectByTypeID";
			return base.SqlMapper.QueryForObject<ERightsType>(stmtId, typeID);
        }
        
        public  void DeleteByTypeID (System.Int32 typeID)
        {
			string stmtId = "RightsTypeMap.DeleteByTypeID";
			base.SqlMapper.Update(stmtId, typeID);
        }
        
        public  void UpdateByTypeID (ERightsType entity)
        {
			string stmtId = "RightsTypeMap.UpdateByTypeID";
			base.SqlMapper.Update(stmtId, entity);
        }


		#endregion

        public IList<ERightsType> GetAll()
        {
            string stmtId = "RightsTypeMap.SelectAll";
            return base.SqlMapper.QueryForList<ERightsType>(stmtId, null);
        }

        public void DeleteRightAndType(int typeID)
        {
            string stmtId = "RightsTypeMap.DeleteRightAndTypeByTypeID";
            base.SqlMapper.Update(stmtId, typeID);
        }
    }
}

